<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>后台管理系统</title>
<js href="__PUBLIC__/Js/Jquery/jquery-1.4.4.min.js" />
<link href="../Public/admin/css/golbal.css" rel="stylesheet" type="text/css" />
<link href="../Public/admin/css/member.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
function gopage(nowpage){
		if(nowpage=='')nowpage=1;
		var totalpage=parseInt("<?php echo $_SESSION['pagetotalPages'];?>");

		if(parseInt(nowpage)==nowpage)
		{
			if(nowpage<=0)
			{
				alert('请输入大于0的整数页码!');
				return false;
			}
			else if(nowpage>totalpage)
			{
				alert('请输入小于最大分页数的整数页码!');
				return false;
			}
		}
		else
		{
			alert('请输入大于0的整数页码!');
			return false;
		}
		var obj=location.href;
		var url=obj.substring(0,obj.indexOf("?")+1);
		var paraString=obj.substring(obj.indexOf("?")+1,obj.length).split("&");
		url="<?php echo $_SESSION['pageurl'];?>";
		url+="&p="+nowpage;
		window.location=url;
	}
</script>
</head>

<body>
<div class="tittle">
<span>气象网管理中心—-会员管理</span>
<a href="{:U('Admin/adduser')}">添加会员</a>
</div>

<div class="infor">
<form action="{:U('Admin/member')}" method="get">
<img src="../Public/admin/images/zoom.jpg" />
<p><span>会员等级</span>
<select name='lid' id="lid">
<option value=0 >所有等级</option>
<volist id='vo' name='name'>
<option value="{$vo.lid}" <?php if($vo['lid'] == $lid){ ?> selected="selected" <?php } ?> >{$vo.lname}</option>
</volist>
</select></p>
<p><span>会员积分大于{$key['lmins']}</span>
<input type="text" id='lmins' name='lmins' value="{$searkey['lmins']}" />
</p>
<p><span>会员积分小于</span>
<input type="text" id='lmaxs' name='lmaxs' value="{$searkey.lmaxs}"/>
</p>
<p><span>会员名称</span>
<input type="text" name='username' value="{$searkey.username}"/>
</p>

<input class="sear" type="submit" value="搜索" />
</form>
</div>

<div class="detab">
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr class="thi">
<th width="106">会员名称</th>
<th width="50">性 别</th>
<th width="150">是否禁用</th>
<th width="194">邮件地址</th>
<th width="95">等级积分</th>
<th width="95">注册日期</th>
<th width="112">操作</th>
</tr>
<if condition="$sta eq 0">
	<tr>
		<td colspan="7" style="text-align:center;">未找到符合条件的会员</td>
	</tr>
<else />
<volist id="vo" name="list">
<tr>
<td>{$vo.username}</td>
<td><eq name="vo['sex']" value="1">男<else/>女</eq></td>
<eq name="vo['status']" value="1">
<td class="start"><span>未禁用</span><a href="javascript:void(0);" onclick="forbidden({$vo['uid']});"> </a></td>
<else />
<eq name="vo['status']" value="0">
<td class="forbid"><span>未激活</span><a href="javascript:void(0);" onclick="enable({$vo['uid']});"> </a></td>
<else />
<td class="forbid"><span>已禁用</span><a href="javascript:void(0);" onclick="enable({$vo['uid']});"> </a></td>
</eq>
</eq>
<td>{$vo['email']}</td>
<td>{$vo['score']}</td>
<td>{$vo.regtime|date="Y-m-d",###}</td>
<td class="last_bt" ><a href="{:U('Admin/edituser',array('uid'=>$vo['uid']))}" class="edit" style="margin-left:45px">编辑</a><!-- <a href="javascript:void(0);" onclick="dele({$vo['uid']});" class="move">删除</a> --></td>
</tr>
</volist>
</if>
</tbody>
</table>
</div>

<div class="num">
{$page}
</div>
<div class="clear"></div>

<script type="text/javascript">
//禁用用户
function forbidden(uid) {
	uid = uid ? uid : getChecked();
	uid = uid.toString();
	if(uid == '' || !confirm('确定要禁用该用户？')) return false;
	$.post("{:U('Admin/forbidden')}", {uid:uid}, function(res){
		if(res == '1') location.href = location.href;
		else alert('禁用失败');
	});
}

//启用用户
function enable(uid) {
	uid = uid ? uid : getChecked();
	uid = uid.toString();
	$.post("{:U('Admin/enable')}", {uid:uid}, function(res){
		if(res == '1') location.href = location.href;
		else alert('激活失败');
	});
}

//删除用户
function dele(uid){
	uid = uid ? uid : getChecked();
	uid = uid.toString();
	if(uid == '' || !confirm('确定要删除该用户？')) return false;
	$.post("{:U('Admin/dele')}", {uid:uid}, function(res){
		if(res == '1') location.href = location.href;
		else alert('禁用失败');
	});
}
//搜索
$(function(){
	$("#lid").change(function(){
    var lid = $(this).val();
    if(lid == 0){
    	$("#lmaxs").val("");
   		$("#lmins").val("");
    	return false;	
    }
    $.post("{:U('Admin/search')}", {lid:lid}, function(res){
   		if(res == '0'){
   			return false;	
   		}else{
	    	var res = jQuery.parseJSON(res);
	    	$("#lmaxs").val(res.lmaxs);
	   		$("#lmins").val(res.lmins);
   		}
	});
});
});
</script>
</body>
</html>
